package com.tramy.data.export.service;

import com.tramy.data.export.annotation.DataSourceChoice;
import com.tramy.data.export.datasource.DatabaseType;
import com.tramy.data.export.mapper.PinShangFactoryMapper;
import com.tramy.data.export.model.PinShangFactory;
import com.tramy.data.export.model.PinShangFactoryExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by honway on 2016/11/7.
 */
@Service
@DataSourceChoice(DatabaseType.pinshang)
public class DemoService {

    @Autowired
    private PinShangFactoryMapper pinShangFactoryMapper;


    public PinShangFactory selectFactoryByID(Long factoryId) {
        PinShangFactoryExample example = new PinShangFactoryExample();
        example.createCriteria().andIdEqualTo(factoryId);
        List<PinShangFactory> factories = pinShangFactoryMapper.selectByExample(example);
        return factories == null ? null : factories.get(0);
    }

}
